New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smooth Motion Streak movement #9693
Conversation
效果请参考企业微盘 https://drive.weixin.qq.com/s?k=ADcAmwdCAAogJ4I3so |
} | ||
findLast = true; | ||
|
||
normal(_normal, dir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -61,6 +61,7 @@ var MotionStreak = cc.Class({ | |||
|
|||
ctor () { | |||
this._points = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我是不太能理解渲染数据挂在组件上的行为。
谁使用,就应该谁持有。
@@ -77,6 +77,11 @@ function computeMiter (miter, lineA, lineB, halfThick, maxMultiple) { | |||
} | |||
|
|||
export default class MotionStreakAssembler extends Assembler2D { | |||
constructor () { | |||
super(); | |||
this._tailShortenTime = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用来计算最后一节拖尾缩短的速度。原有算法不对,导致时灵时不灵。
} | ||
// update head | ||
cur.setPoint(tx, ty); | ||
cur.time = fadeTime + dt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
只有移动了,才能重新激活拖尾(的时间)。如果不动,拖尾就应该逐渐消失。原先每一帧都重新激活拖尾,会导致最后一节拖尾突然消失。
} | ||
} | ||
else { | ||
this._tailShortenTime = p.time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果 point 数量不足,不缩短拖尾,因为缺少计算出平均速度的变量。会导致移动速度比较慢时,第一节拖尾始终出不来。
不要把开发者当做小白鼠,优化完没有经过测试和验收的吗,看看论坛吧,一堆bug啊啊啊啊啊 |
Changelog:
优化的点:
警告: